<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<body>
<ui:composition template="../template/templateAutenticado.xhtml">
	<ui:define name="central">
	<div align="center">
		<div align="left">
			<h:form id="formVoltar">
				<h:commandLink action="PrincipalAluno">
					<h:graphicImage value="/imagens/voltar.png" width="48" height="48" style="border:0px;"/>
				</h:commandLink>
			</h:form>
		</div>
		<br/>
		<a4j:form id="formAgendarAula">
		<rich:dataTable value="#{Aluno.compromissos}" var="compromisso" width="800px" rows="10" reRender="datascroller">
			<f:facet name="header">
				<h:outputText value="#{msg.AgendarAula}" />
			</f:facet>
			<rich:column sortBy="#{compromisso.dataHora}">
				<f:facet name="header">
					<h:outputText value="#{msg.Dia}" />
				</f:facet>
				<h:outputText value="#{compromisso.dataHora.time}">
					<f:convertDateTime pattern="dd/MM/yyyy"/>  
				</h:outputText>
			</rich:column>
			<rich:column sortBy="#{compromisso.dataHora}">
				<f:facet name="header">
					<h:outputText value="#{msg.Hora}" />
				</f:facet>
				<h:outputText value="#{compromisso.dataHora.time}">
					<f:convertDateTime pattern="h:mm a" timeZone="America/Sao_Paulo"/>  
				</h:outputText>
			</rich:column>
			<rich:column sortBy="#{compromisso.professor.nome}">
				<f:facet name="header">
					<h:outputText value="#{msg.Professor}" />
				</f:facet>
				<h:outputText value="#{compromisso.professor.nome}" />
			</rich:column>
			<rich:column sortBy="#{compromisso.disponivel}">
				<f:facet name="header">
					<h:outputText value="#{msg.Disponibilidade}" />
				</f:facet>
				<h:outputText value="#{compromisso.disponivel}" />
			</rich:column>
			<rich:column sortBy="#{compromisso.unidade}">
				<f:facet name="header">
					<h:outputText value="#{msg.Unidade}" />
				</f:facet>
				<h:outputText value="#{compromisso.unidade}" />
			</rich:column>
			<rich:column>
				<f:facet name="header">
					<h:outputText value="#{msg.Agendar}" />
				</f:facet>
				<h:commandLink onclick="return confirm('Deseja marcar este horário? Após a confirmação apenas o professor poderá cancelar ou alterar.');" action="#{Aluno.marcarCompromisso}">
					 <f:param name="Codigo" value="#{compromisso.codigo}"/>
					 <f:param name="Unidade" value="#{compromisso.unidade}"/>
					 <h:outputText value="#{msg.Agendar}" />
				</h:commandLink> 
			</rich:column>
			<f:facet name="footer">
               	<rich:datascroller id="datascroller" />
            </f:facet>
		</rich:dataTable>
		</a4j:form>
	</div>
	</ui:define>
</ui:composition>
</body>
</html>
